import json
import unittest
from parameterized import parameterized

from 其他.lianxi.login import Login


def build_data():
    with open("data.json", encoding='utf-8') as f:
        result = json.load(f)
        data = []
        for i in result:
            data.append((i.get('a'), i.get('b'), i.get('expect')))
        return data


class TestLogin(unittest.TestCase):
    # 组织测试数据并传参
    @parameterized.expand(build_data())
    def test_login(self, a, b, expect):
        self.assertEqual(expect, Login(a, b))
